﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using _4T.Data;
using _4T.BLL;

namespace _4T
{
    public partial class ProfileList_CMS : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                PQTPager1.CurrentPageIndex = 0;
            }
            LoadProfileList();
        }

        private void LoadProfileList()
        {
            ProfileBLL profileBLL = new ProfileBLL();
            List<CMS_Profile> list = profileBLL.GetProfileListForCMS(PQTPager1.CurrentPageIndex + 1, PQTPager1.PageSize, "");
            rptProfileList.DataSource = list;
            rptProfileList.DataBind();
            int total = profileBLL.GetProfileTotalRecordForCMS();
            if (total > 0)
            {
                PQTPager1.RecordCount = total;
            }
        }

        protected void PQTPager1_PageIndexChanged(object sender, PQT.PageIndexChangedEventArgs e)
        {
            PQTPager1.CurrentPageIndex = e.NewPageIndex;
            LoadProfileList();
        }
    }
}